package com.expdatacloud.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Calendar;
import java.util.Date;

/**
 * 收货预定看板VO
 *
 * @author jie
 * @date 2019/12/1 -14:35
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ReceivingBoardVo {

    /**
     * 据点
     */
    @Excel(name = "据点", height = 20, width = 30)
    private String storerkey;

    /**
     * 收货单
     */
    @Excel(name = "收货单", height = 20, width = 30)
    private String receiptKey;

    /**
     * 单据类型
     */
    @Excel(name = "单据类型", height = 20, width = 30)
    private String voucherType;

    /**
     * 送货日期
     */
    @Excel(name = "送货日期", height = 20, width = 30)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date deliveryDate;

    /**
     * 品号
     */
    @Excel(name = "品号", height = 20, width = 30)
    private String sku;

    /**
     * 品名
     */
    @Excel(name = "品名", height = 20, width = 30)
    private String descr;

    /**
     * 规格
     */
    @Excel(name = "规格", height = 20, width = 30)
    private String specification;

    /**
     * 供应商代码
     */
    @Excel(name = "供应商代码", height = 20, width = 30)
    private String supplierCode;

    /**
     * 供应商简称
     */
    @Excel(name = "供应商简称", height = 20, width = 30)
    private String supplierShort;

    /**
     * 计划收货数量
     */
    @Excel(name = "计划收货数量", height = 20, width = 30)
    private String goodsQuantity;

    /**
     * 单位
     */
    @Excel(name = "单位", height = 20, width = 30)
    private String unit;

    /**
     * 体积
     */
    @Excel(name = "体积", height = 20, width = 30)
    private String volume;

    /**
     * 采购订单
     */
    @Excel(name = "采购订单", height = 20, width = 30)
    private String purchaseOrder;

    /**
     * 采购项次
     */
    @Excel(name = "采购项次", height = 20, width = 30)
    private String purchaseItems;

    /**
     * 收货状态
     */
    @Excel(name = "收货状态", height = 20, width = 30)
    private String receiptStatus;

    public Long getDelayTime() {
        if (deliveryDate != null) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(deliveryDate);
            long time1 = cal.getTimeInMillis();
            cal.setTime(new Date());
            long time2 = cal.getTimeInMillis();
            long delayTime = (time2 - time1) / (1000 * 3600 * 24);
            return delayTime;
        }
        return null;
    }

    /**
     * 延期时间
     */
    @Excel(name = "延期时间", height = 20, width = 30)
    private Long delayTime;

}
